package java8_24;

import java8_23.market.Vip;

/**
 * @author oldliu
 * @since 1.0
 */
public class Voter {
    private String name;
    private boolean vote=false;
    private static int votesNum=0;
    public Voter(String n){
        name=n;
    }
    public void vote(String shei){
        if(votesNum>=100){
            System.out.println("投票次数超过100了，停止！");
            return;
        }
        if(vote){
            System.out.println(name+"已经投了，不能再投！");
            return;
        }
        System.out.println(name+"投给了"+shei);
        vote=true;
        votesNum++;
    }

    public static void main(String[] args) {
        for(int i=1;i<=300;i++){
            Voter v=new Voter("刘"+i);
            v.vote("忒靠谱总统");
            v.vote("忒靠谱总统");
        }
    }
}
